//
//  YBRegisterViewController.m
//  ShangHaiHuDongApp
//
//  Created by apple on 18/6/2.
//  Copyright © 2018年 刘应平. All rights reserved.
//

#import "YBRegisterViewController.h"
#import "ZJAdditions.h"
//#import "NetWorkingManager.h"
#import "UIButton+countDown.h"
#import "ZJTabBarController.h"
//#import "ZJReportViewController.h"
//#import "ZJUserRegisterInfoModel.h"
//#import "LPChooseReportTypeViewController.h"
#import "YBLoginViewController.h"
#import "HomeMenuViewController.h"
#import "ElectiveViewController.h"
#import "YBElectiveViewController.h"

#import "SubjectViewController.h"
#import "MyViewController.h"
@interface YBRegisterViewController ()<UITextFieldDelegate , UITabBarControllerDelegate>

/** 姓名 */
@property (nonatomic, strong) UITextField *name;
/** 安全码 */
@property (nonatomic, strong) UITextField *safe;
/** 安全码图片 */
@property (nonatomic, strong) UIImageView *safeImageView;
/** 手机号码 */
@property (nonatomic, strong) UITextField *phoneNumber;
/** 验证码 */
@property (nonatomic, strong) UITextField *verification;
/** 密码 */
@property (nonatomic, strong) UITextField *passwordTextField;
/** 获取验证码 */
@property (nonatomic, strong) UIButton *verificationButton;
/** 注册 */
@property (nonatomic, strong) UIButton *userRegist;
@end

@implementation YBRegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.titlelabel.text = @"账号激活";
    [self setupUI];
    self.phoneNumber.text = self.phoneString;
//    [self.safeImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@api/VerifyCode/activeyzmcode/%.0lf" , HTMLURL , ([[NSDate date] timeIntervalSince1970] * 1000)]]];
    [YBRequestManager request_sessionIdWithSuccessBlock:^(id object) {
        if ([object[@"code"] integerValue] == 1) {
            [[NSUserDefaults standardUserDefaults] setObject:object[@"data"][@"sessionId"] forKey:@"sessionId"];
        }
    } failBlock:^(id object) {
        
    }];
}
- (void)setupUI{
    [self.view addSubview:self.name];
//    [self.view addSubview:self.safe];
//    [self.view addSubview:self.safeImageView];
    [self.view addSubview:self.phoneNumber];
    [self.view addSubview:self.verification];
    [self.view addSubview:self.passwordTextField];
    [self.view addSubview:self.verificationButton];
    [self.view addSubview:self.userRegist];
    
    //手机号提示
    UILabel *phoneLabel = [UILabel new];
    phoneLabel.text = @"手机号 :";
    phoneLabel.textColor = [UIColor textBlackColor];
    phoneLabel.font = [UIFont titleTextFont];
    //验证码提示
    UILabel *VLabel = [UILabel new];
    VLabel.text = @"验证码 :";
    VLabel.textColor = [UIColor textBlackColor];
    VLabel.font = [UIFont titleTextFont];
    
    //姓名提示
    UILabel *nameLabel = [UILabel new];
    nameLabel.text = @"帐号 :";
    nameLabel.textColor = [UIColor textBlackColor];
    nameLabel.font = [UIFont titleTextFont];
    
    //姓名提示
    UILabel *pwdLabel = [UILabel new];
    pwdLabel.text = @"密码 :";
    pwdLabel.textColor = [UIColor textBlackColor];
    pwdLabel.font = [UIFont titleTextFont];
    
    [self.view addSubview:nameLabel];
    [self.view addSubview:pwdLabel];
    [self.view addSubview:phoneLabel];
    [self.view addSubview:VLabel];
    
    
    NSString * detailString = @"说明：\n1、由于您是首次进入平台学习，因此需要对您的账号进行激活验证。\n2、请先填写用户名密码，然后在点击激活。\n3、为了保障您的账号安全，请输入您的姓名和验证码。\n4、激活的手机号需要和导入的手机号相同。";
    UILabel * detailLabel = [ToolClass creatLabelWithFrame:CGRectMake(0, 0, 1, 1) font:[UIFont subTitleTextFontSize] textColor:[UIColor themeColor] text:@""];
    NSMutableAttributedString * detailAttributedString = [[NSMutableAttributedString alloc]initWithString:detailString];
    [detailAttributedString addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14 * [UIScreen zj_textFontScale]] range:NSMakeRange(0, 3)];
    [detailAttributedString addAttribute:NSFontAttributeName value:[UIFont subTitleTextFont] range:NSMakeRange(3, detailAttributedString.length - 3)];
    
    CGFloat detailHeight = [detailAttributedString boundingRectWithSize:CGSizeMake([UIScreen zj_screenWith] - 54 * [UIScreen zj_screenWScale], CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size.height;
    
    detailLabel.attributedText = detailAttributedString;
    
    [self.view addSubview:detailLabel];
    
//    safeLabel.sd_layout
//    .topSpaceToView(self.name, 23 * [UIScreen zj_screenHScale])
//    .leftEqualToView(self.name)
//    .rightEqualToView(self.name)
//    .heightIs([NSString heightWithTextFontSize:[UIFont titleTextFontSize]]);
//    
//    self.safeImageView.sd_layout
//    .topSpaceToView(safeLabel, 11 * [UIScreen zj_screenHScale])
//    .rightEqualToView(safeLabel)
//    .widthIs(100 * [UIScreen zj_screenWScale])
//    .heightRatioToView(self.name, 1);
//    
//    self.safe.sd_layout
//    .topEqualToView(self.safeImageView)
//    .leftEqualToView(safeLabel)
//    .rightSpaceToView(self.safeImageView, 12 * [UIScreen zj_screenWScale])
//    .heightRatioToView(self.safeImageView, 1);
    
    phoneLabel.sd_layout
    .topSpaceToView(self.navigView,25 * [UIScreen zj_screenHScale])
    .leftSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .rightSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .heightIs([NSString heightWithTextFontSize:[UIFont titleTextFontSize]]);
    
    self.verificationButton.sd_layout
    .topSpaceToView(phoneLabel, 11 * [UIScreen zj_screenHScale])
    .rightEqualToView(phoneLabel)
    .widthIs(100 * [UIScreen zj_screenWScale])
    .heightRatioToView(self.name, 1);
    
    self.phoneNumber.sd_layout
    .topSpaceToView(phoneLabel, 11 * [UIScreen zj_screenHScale])
    .leftEqualToView(phoneLabel)
    .rightSpaceToView(self.verificationButton, 12 * [UIScreen zj_screenWScale])
    .heightIs(44 * [UIScreen zj_screenHScale]);
    
    VLabel.sd_layout
    .topSpaceToView(self.phoneNumber, 23 * [UIScreen zj_screenHScale])
    .leftEqualToView(self.phoneNumber)
    .rightEqualToView(self.phoneNumber)
    .heightIs([NSString heightWithTextFontSize:[UIFont titleTextFontSize]]);

    self.verification.sd_layout
    .topSpaceToView(VLabel, 11 * [UIScreen zj_screenHScale])
    .leftSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .rightSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .heightRatioToView(self.verificationButton, 1);
    
    nameLabel.sd_layout
    .topSpaceToView(self.verification,23 * [UIScreen zj_screenHScale])
    .leftSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .rightSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .heightIs([NSString heightWithTextFontSize:[UIFont titleTextFontSize]]);
    
    self.name.sd_layout
    .topSpaceToView(nameLabel, 11 * [UIScreen zj_screenHScale])
    .leftEqualToView(nameLabel)
    .rightEqualToView(nameLabel)
    .heightIs(44 * [UIScreen zj_screenHScale]);
    
    pwdLabel.sd_layout
    .topSpaceToView(self.name,23 * [UIScreen zj_screenHScale])
    .leftSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .rightSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .heightIs([NSString heightWithTextFontSize:[UIFont titleTextFontSize]]);
    
    self.passwordTextField.sd_layout
    .topSpaceToView(pwdLabel, 11 * [UIScreen zj_screenHScale])
    .leftEqualToView(pwdLabel)
    .rightEqualToView(pwdLabel)
    .heightIs(44 * [UIScreen zj_screenHScale]);
    
    detailLabel.sd_layout
    .topSpaceToView(self.passwordTextField, 23 * [UIScreen zj_screenHScale])
    .leftSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .rightSpaceToView(self.view, 27 * [UIScreen zj_screenWScale] - 1)
    .heightIs(detailHeight + 1);
    
    self.userRegist.sd_layout
    .topSpaceToView(detailLabel, ItemHeight * 20)
    .leftSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .rightSpaceToView(self.view, 27 * [UIScreen zj_screenWScale])
    .heightRatioToView(self.name, 1);
}


- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
    if ([viewController isKindOfClass:[HomeMenuViewController class]]) {
        return YES;
    }else if ([viewController isKindOfClass:[YBElectiveViewController class]]) {
        return [self isLoging];
    }else if ([viewController isKindOfClass:[SubjectViewController class]]) {
        return  [self isLoging];
    }else if ([viewController isKindOfClass:[MyViewController class]]) {
        return [self isLoging];
    }
    return YES;
}

- (BOOL)isLoging{
    if (YBUSERINFOMODEL.studentId.length > 0) {
        return YES;
    }else{//未登录
        UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"请先登录" message:nil preferredStyle:UIAlertControllerStyleAlert];
        [alertController addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            YBLoginViewController *vc = [YBLoginViewController new];
            [[ToolClass getMainNavigationController] pushViewController:vc animated:YES];
        }]];
        [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
            
        }]];
        [[ToolClass getMainNavigationController] presentViewController:alertController animated:YES completion:nil];
        
        return NO;
    }
}



#pragma mark - 点击事件
/** 发送验证码 */
- (void)action_sendVerification{
    [self.name resignFirstResponder];
    [self.phoneNumber resignFirstResponder];
    [self.verification resignFirstResponder];
    if (self.phoneNumber.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请输入的手机号码"];
        return;
    }
    if (![CManager zj_validateMobile:self.phoneNumber.text]) {
        [YJProgressHUD showMsgWithoutView:@"请输入正确的手机号码"];
        return;
    }
    [YJProgressHUD showMessage:@"正在发送..." duration:10 view:self.view];
    [YBRequestManager request_sendVerifySMSCodeWithPhone:self.phoneNumber.text successBlock:^(id object) {
        [YJProgressHUD hide];
        if ([object[@"code"] integerValue] == 1) {
            [self.verificationButton startWithTime:60 title:@"重新获取" countDownTitle:@"重新获取" mainColor:[UIColor textBlackColor] countColor:[UIColor textBlackColor]];
        }
        else{
            [YJProgressHUD showMsgWithoutView:@"获取失败"];
        }
    } failBlock:^(id object) {
        [YJProgressHUD showMsgWithoutView:@"获取失败"];
    }];
    
}



/** 注册 */
- (void)action_userRegist{
    [self.view endEditing:YES];
//    if (self.safe.text.length == 0) {
//        [YJProgressHUD showMsgWithoutView:@"请输入的图片验证码"];
//        return;
//    }
    if (self.phoneNumber.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请输入的手机号码"];
        return;
    }
    if (![CManager zj_validateMobile:self.phoneNumber.text]) {
        [YJProgressHUD showMsgWithoutView:@"请输入正确的手机号码"];
        return;
    }
    if (self.verification.text.length == 0) {
        [YJProgressHUD showMsgWithoutView:@"请输入的短信验证码"];
        return;
    }
    if (self.passwordTextField.text.length < 6) {
        [YJProgressHUD showMsgWithoutView:@"密码长度必须大于6位"];
        return;
    }
    //输入的信息都正确
    [YJProgressHUD showMessage:@"激活中..." duration:30 view:self.view];
    [YBRequestManager request_activationAccountWithUsername:self.phoneNumber.text password:self.passwordTextField.text name:@"" inputyzmcode:@"" inputsmscode:self.verification.text cellphone:self.phoneNumber.text successBlock:^(id object) {
        [YJProgressHUD hide];
        if([object[@"code"] integerValue] == 1) {
            if ([object[@"data"][@"result"] integerValue] == 1 && [object[@"data"][@"index"] integerValue] == 0) {
                [self loginApp];
            }
            else{
                [YJProgressHUD showMsgWithoutView:[NSString stringWithFormat:@"%@" , object[@"data"][@"message"]]];
            }
        }
        else{
            [YJProgressHUD showMsgWithoutView:@"激活失败"];
        }
    } failBlock:^(id object) {
        [YJProgressHUD showMsgWithoutView:@"激活失败"];
    }];

}


-(void)loginApp{
    [YJProgressHUD showMessage:@"正在登录中" duration:30 view:self.view];
    [YBRequestManager request_loginWithUsername:self.username password:self.password successBlock:^(id object) {
        [YJProgressHUD hide];
        if ([object[@"code"] integerValue] == 1) {
            if ([object[@"data"][@"result"] integerValue] == 1) {
                [self rememberUserInfoWithDic:object[@"data"]];
                [YJProgressHUD showMessage:@"登录成功" inView:self.view compeleteBlock:^{
                    ZJTabBarController * rootViewController = [ZJTabBarController new];
                    rootViewController.delegate = self;
                    UINavigationController * mainNav = [[UINavigationController alloc]initWithRootViewController:rootViewController];
                    mainNav.navigationBar.hidden = YES;
                    [UIApplication sharedApplication].keyWindow.rootViewController = mainNav;
                    [[UIApplication sharedApplication].keyWindow makeKeyAndVisible];
                }];
                
            }
            else{
                [YJProgressHUD showMessage:[NSString stringWithFormat:@"%@" , object[@"data"][@"message"]] inView:self.view compeleteBlock:^{
                    [self.navigationController popViewControllerAnimated:YES];
                }];
            }
        }
        else{
            [YJProgressHUD showMessage:@"登录失败" inView:self.view compeleteBlock:^{
                [self.navigationController popViewControllerAnimated:YES];
            }];
        }
        
    } failBlock:^(id object) {
        [YJProgressHUD showMessage:@"登录失败" inView:self.view compeleteBlock:^{
            [self.navigationController popViewControllerAnimated:YES];
        }];
    }];
}


-(void)rememberUserInfoWithDic:(NSDictionary *)dic{
    [[NSUserDefaults standardUserDefaults] setObject:dic[@"token"] forKey:@"token"];
    [[NSUserDefaults standardUserDefaults] setObject:dic[@"loginUser"] forKey:@"loginUser"];
    [[NSUserDefaults standardUserDefaults] setObject:dic[@"loginUser"][@"sessionId"] forKey:@"sessionId"];
    [[NSUserDefaults standardUserDefaults] setObject:self.username forKey:@"username"];
    [[NSUserDefaults standardUserDefaults] setObject:self.password forKey:@"password"];
}

#pragma mark - 验证验证码

//- (void)verificationNumberSuccee:(void(^)(NSDictionary * dict))succee Fail:(void(^)())fail{
//    [YJProgressHUD show:@"" inView:self.view mode:YJProgressModeLoading];
//    NSDictionary *dict = @{@"MOBILE":self.phoneNumber.text,@"CODE_SOURCE":@"register",@"MOBILE_CODE":self.verification.text,@"USER_NAME":@""};
//    [NetWorkingManager postWithUrlString:[NetWorkingURL registerUserInfo] Parameter:dict Success:^(id object) {
//        [YJProgressHUD hide];
//        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
//        if ([model.STATE isEqualToString:@"30000"]) {//验证成功
//            succee(object);
//        }else if([model.STATE isEqualToString:@"30003"]){//30002 验证码错误 30003 改手机号已被注册 30001 服务器执行错误
//            [YJProgressHUD showMsgWithoutView:@"手机号已经被注册"];
//        }else if([model.STATE isEqualToString:@"30008"]){//30002 验证码错误 30003 改手机号已被注册 30001 服务器执行错误 30008 未找到党员信息
//            [YJProgressHUD showMsgWithoutView:@"未找到党员信息"];
//        }else{
//            fail();
//        }
//    } Fail:^(id object) {
//        [YJProgressHUD showMsgWithoutView:@"验证码错误"];
//    }];
//    
//}

#pragma mark - UITextFieldDelegate 协议方法
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    NSString * toBeString = [textField.text stringByReplacingCharactersInRange:range withString:string];
    if (textField == self.phoneNumber) {
        self.name.text = toBeString;
        if (toBeString.length >= 11 && range.length!=1){
            self.name.text = [toBeString substringToIndex:11];
            textField.text = [toBeString substringToIndex:11];
            return NO;
            
        }
    }else if (textField == self.verification) {
        if (toBeString.length >= 6 && range.length!=1){
            textField.text = [toBeString substringToIndex:6];
            return NO;
            
        }
    }
    
    return YES;
}


-(void)option_tapSafeImageWithGesture:(UITapGestureRecognizer *)gesture{
    [self.safeImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@api/VerifyCode/activeyzmcode/%.0lf" , HTMLURL , ([[NSDate date] timeIntervalSince1970] * 1000)]]];
}

#pragma mark - Setter
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    
    [textField resignFirstResponder];//取消第一响应者
    
    return YES;
}

#pragma mark - Getters

- (UITextField *)name{
    if (_name == nil){
        _name = [[UITextField alloc]init];
        _name.placeholder = @"请输入您的姓名";
        _name.textColor = [UIColor textBlackColor];
        _name.font = [UIFont titleTextFont];
        [_name setTextFieldLeftforWidth:14 * [UIScreen zj_screenWScale]];
        [_name setTextFieldRightforWidth:14 * [UIScreen zj_screenWScale]];
        _name.layer.borderColor = [UIColor zj_colorWithHexString:@"ededed"].CGColor;
        _name.layer.borderWidth = 1.0;
        _name.sd_cornerRadius = @(4 * [UIScreen zj_screenHScale]);
        _name.returnKeyType = UIKeyboardTypeTwitter;
        _name.userInteractionEnabled = NO;
        _name.backgroundColor = [UIColor themeGrayColor];
        _name.delegate = self;
    }
    return _name;
}


- (UITextField *)safe{
    if (_safe == nil){
        _safe = [[UITextField alloc]init];
        _safe.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
        _safe.placeholder = @"请输入右侧的安全码";
        _safe.textColor = [UIColor textBlackColor];
        _safe.font = [UIFont titleTextFont];
        [_safe setTextFieldLeftforWidth:14 * [UIScreen zj_screenWScale]];
        [_safe setTextFieldRightforWidth:14 * [UIScreen zj_screenWScale]];
        _safe.layer.borderColor = [UIColor zj_colorWithHexString:@"ededed"].CGColor;
        _safe.layer.borderWidth = 1.0;
        _safe.sd_cornerRadius = @(4 * [UIScreen zj_screenHScale]);
        _safe.returnKeyType = UIKeyboardTypeTwitter;
        _safe.delegate = self;
    }
    return _safe;
}


- (UIImageView *)safeImageView{
    if (_safeImageView == nil){
        _safeImageView = [[UIImageView alloc]init];
        _safeImageView.layer.cornerRadius = 4 * [UIScreen zj_screenHScale];
        _safeImageView.layer.borderColor = [UIColor zj_colorWithHexString:@"ededed"].CGColor;
        _safeImageView.layer.borderWidth = 1.0;
        _safeImageView.clipsToBounds = YES;
        _safeImageView.userInteractionEnabled = YES;
        UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(option_tapSafeImageWithGesture:)];
        [_safeImageView addGestureRecognizer:tapGesture];
    }
    return _safeImageView;
}

- (UITextField *)phoneNumber{
    if (_phoneNumber == nil){
        _phoneNumber = [[UITextField alloc]init];
        _phoneNumber.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
        _phoneNumber.placeholder = @"请输入手机号";
        _phoneNumber.textColor = [UIColor textBlackColor];
        _phoneNumber.font = [UIFont titleTextFont];
        [_phoneNumber setTextFieldLeftforWidth:14 * [UIScreen zj_screenWScale]];
        [_phoneNumber setTextFieldRightforWidth:14 * [UIScreen zj_screenWScale]];
        _phoneNumber.delegate = self;
        _phoneNumber.layer.borderColor = [UIColor zj_colorWithHexString:@"ededed"].CGColor;
        _phoneNumber.layer.borderWidth = 1.0;
        _phoneNumber.sd_cornerRadius = @(4 * [UIScreen zj_screenHScale]);
        _phoneNumber.returnKeyType = UIKeyboardTypeTwitter;
        
    }
    return _phoneNumber;
}

- (UITextField *)verification{
    if (_verification  == nil){
        _verification = [[UITextField alloc]init];
        _verification.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
        _verification.placeholder = @"请输入手机验证码";
        _verification.textColor = [UIColor textBlackColor];
        _verification.font = [UIFont titleTextFont];
        [_verification setTextFieldLeftforWidth:14 * [UIScreen zj_screenWScale]];
        _verification.delegate = self;
        [_verification setTextFieldRightforWidth:14 * [UIScreen zj_screenWScale]];
        _verification.layer.borderColor = [UIColor zj_colorWithHexString:@"ededed"].CGColor;
        _verification.layer.borderWidth = 1.0;
        _verification.sd_cornerRadius = @(4 * [UIScreen zj_screenHScale]);
        _verification.returnKeyType = UIKeyboardTypeTwitter;
        
    }
    return _verification;
}

- (UITextField *)passwordTextField{
    if (_passwordTextField  == nil){
        _passwordTextField = [[UITextField alloc]init];
        _passwordTextField.keyboardType = UIKeyboardTypeASCIICapable;
        _passwordTextField.placeholder = @"设置密码";
        _passwordTextField.textColor = [UIColor textBlackColor];
        _passwordTextField.font = [UIFont titleTextFont];
        [_passwordTextField setTextFieldLeftforWidth:14 * [UIScreen zj_screenWScale]];
        _passwordTextField.delegate = self;
        [_passwordTextField setTextFieldRightforWidth:14 * [UIScreen zj_screenWScale]];
        _passwordTextField.layer.borderColor = [UIColor zj_colorWithHexString:@"ededed"].CGColor;
        _passwordTextField.layer.borderWidth = 1.0;
        _passwordTextField.sd_cornerRadius = @(4 * [UIScreen zj_screenHScale]);
        _passwordTextField.returnKeyType = UIKeyboardTypeTwitter;
        
    }
    return _passwordTextField;
}

- (UIButton *)verificationButton{
    if (_verificationButton == nil){
        _verificationButton = [[UIButton alloc]init];
        [_verificationButton setTitle:@"发送验证码" forState:UIControlStateNormal];
        [_verificationButton setTitleColor:[UIColor textBlackColor] forState:UIControlStateNormal];
        _verificationButton.titleLabel.font = [UIFont systemFontOfSize:15 * [UIScreen zj_textFontScale]];
        _verificationButton.layer.cornerRadius = 4 * [UIScreen zj_screenHScale];
        _verificationButton.layer.borderColor = [UIColor zj_colorWithHexString:@"ededed"].CGColor;
        _verificationButton.layer.borderWidth = 1.0;
        [_verificationButton addTarget:self action:@selector(action_sendVerification) forControlEvents:UIControlEventTouchUpInside];
    }
    return _verificationButton;
}
- (UIButton *)userRegist{
    if (_userRegist == nil){
        _userRegist = [[UIButton alloc]init];
        [_userRegist setTitle:@"激活" forState:UIControlStateNormal];
        [_userRegist setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _userRegist.backgroundColor = [UIColor themeColor];
        _userRegist.titleLabel.font = [UIFont titleTextFont];
        _userRegist.layer.cornerRadius = 4 * [UIScreen zj_screenHScale];
        [_userRegist addTarget:self action:@selector(action_userRegist) forControlEvents:UIControlEventTouchUpInside];
    }
    return _userRegist;
}

@end
